<<<<<<< HEAD
import { createRouter,createWebHistory,createWebHashHistory} from 'vue-router'
import Vue from 'vue'
import Router from 'vue-router'
import myindex from '@/components/myindex'
import test from '@/components/test'
import myfoot from "../components/myfoot";
import register from "../components/register";
import login_1 from "../components/login_1";
import user_center from "../components/user_center";
import myfile from "../components/myfile";
import mytree from "../components/mytree";
import addcate from "../components/addcate";
import fileall from "../components/fileall";
import addcourse from "../components/addcourse";
import videolist from "../components/videolist";
import editcourse from "../components/editcourse"
import mycourse from "../components/mycourse";

//作业
import get_author from "../components/myword/get_author";
import user from "../components/myword/user";
import get_books from "../components/myword/get_books";
import people from "../components/myword/people";
import x from "../components/myword/x";
import login2 from "../components/myword/login2";
import goods_show from "../components/myword/goods_show";
import school from "../components/myword/school";
import test_login from "../components/test/test_login";
import test_denglu from "../components/test/test_denglu";
import test_dingdan from "../components/test/test_dingdan";


Vue.use(Router)

var routes = [
  {
    path: '/test_dingdanlist',
    name: 'test_dingdan',
    component: test_dingdan
  },
  {
    path: '/test_dingdan',
    name: 'test_dingdan',
    component: test_dingdan
  },
  {
    path: '/test_denglu',
    name: 'test_denglu',
    component: test_denglu
  },
  {
    path: '/test_login',
    name: 'test_login',
    component: test_login
  },
  {
    path: '/school',
    name: 'school',
    component: school
  },
  {
    path: '/goods_show',
    name: 'goods_show',
    component: goods_show
  },
  {
    path: '/login2',
    name: 'login2',
    component: login2
  },
  {
    path: '/x',
    name: 'x',
    component: x
  },
  {
    path: '/people',
    name: 'people',
    component: people
  },
  {
    path: '/get_books',
    name: 'get_books',
    component: get_books
  },
  {
    path: '/user',
    name: 'user',
    component: user
  },
  {
    path: '/get_author',
    name: 'get_author',
    component: get_author
  },
  {
    path: '/editcourse',
    name: 'editcourse',
    component: editcourse
  },
  {
    path: '/mycourse',
    name: 'mycourse',
    component: mycourse
  },
  {
    path: '/videolist',
    name: 'videolist',
    component: videolist
  },
  {
    path: '/addcourse',
    name: 'addcourse',
    component: addcourse
  },
  {
    path: '/fileall',
    name: 'fileall',
    component: fileall
  },
  {
    path: '/addcate',
    name: 'addcate',
    component: addcate
  },
  {
    path: '/mytree',
    name: 'mytree',
    component: mytree
  },
  {
    path: '/myfile',
    name: 'myfile',
    component: myfile
  },
  {
    path: '/user_center',
    name: 'user_center',
    component: user_center,
    //拦截器的使用
    beforeEnter:(to,from,next) =>{
        //判断该用户是否登录
        if (localStorage.getItem('username')){
          next();
        }else{
          next('/login_1');
        }
    }
  },
  {
    path: '/login_1',
    name: 'login_1',
    component: login_1
  },
  {
    path: '/',
    name: 'myindex',
    component: myindex
  },
  {
    path: '/test',
    name: 'test',
    component: test
  },
  {
    path: '/myfoot',
    name: 'myfoot',
    component: myfoot
  },
  {
    path: '/register',
    name: 'register',
    component: register
  },


]
const router = new createRouter({
  history:createWebHashHistory(),
  routes,
})

export {
  router
}

export default new Router({
  routes: routes,
  mode: 'history'   /*hash*/
})
=======
import Vue from 'vue'
import Router from 'vue-router'
import myindex from '@/components/myindex'
import test from '@/components/test'
import register from '@/components/register'
import mylogin from '@/components/mylogin'
import user from '@/components/user'
import filelist from '@/components/filelist'
import addcate from '@/components/addcate'
import addcourse from '@/components/addcourse'
import mycourse from '@/components/mycourse'
import editcourse from '@/components/editcourse'


Vue.use(Router)

var routes = [
        {
          path:'/',
          name:'myindex',
          component:myindex
        },
         {
          path:'/test',
          name:'test',
          component:test
        },
        {
          path:'/register',
          name:'register',
          component:register
        },
        {
          path:'/addcourse',
          name:'addcourse',
          component:addcourse
        },
        {
          path:'/addcate',
          name:'addcate',
          component:addcate
        },
        {
          path:'/editcourse',
          name:'editcourse',
          component:editcourse
        },
        {
          path:'/login',
          name:'mylogin',
          component:mylogin
        },
        {
          path:'/mycourse',
          name:'mycourse',
          component:mycourse
        },
        {
          path:'/filelist',
          name:'filelist',
          component:filelist
        },
        {
          path:'/user',
          name:'user',
          component:user,
          //拦截器的使用
          beforeEnter:(to,from,next) => {

            //判断该用户是否登录
            if(localStorage.getItem("username")){

                next();

            }else{

                next('/login');
            }


          }
        },
        
    
        
]

export default new Router({
  routes:routes,
  mode:'history'   /*hash*/
})
>>>>>>> afcc523b004321adbe11ac83d9b5087146701336
